﻿/*****************************************************************//**
 *
 * @file   FITKAbaqusPart.h
 * @brief  Abaqus Part 的数据结构
 * @author fulipeng (flipengqd@yeah.net)
 * @date   2024-03-15
 *
 *********************************************************************/
#ifndef __FITKABAQUS_PART_H__
#define __FITKABAQUS_PART_H__

#include "FITKAbaqusDataAPI.h"
#include "FITK_Interface/FITKInterfaceModel/FITKAbstractModel.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataManager.hpp"

namespace Interface
{
    class FITKAbaMeshPartVTK;
    class FITKComponentManager;
    class FITKSectionAssignManager;
    class FITKAbaPartEngineeringFeature;
    class FITKModelSet;
    class FITKCoordinateSystemManager;
    class FITKAbaMaterialOrientationManager;
    class FITKAbaBeamOrientationManager;
    class FITKAbsGeoCommand;
    class FITKAbsGeoShapeAgent;

    class FITKSurfaceMeshingParameter;
    class FITKVolumeMeshingParameter;

}

namespace AbaqusData
{
    /**
     * @brief Abaqus Part 的数据结构
     * @author fulipeng (flipengqd@yeah.net)
     * @date 2024-03-15
     */
    class FITKAbaqusDataAPI FITKAbaqusPart : public Interface::FITKAbstractModel
    {
        FITKSafeDownCastA(FITKAbaqusPart, Core::FITKAbstractDataObject);
        FITKCLASS(AbaqusData, FITKAbaqusPart);
    public:
        explicit FITKAbaqusPart();
        virtual ~FITKAbaqusPart();

        /**
         * @brief 获取模型类型
         * @return 模型类型
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-03-15
         */
        Interface::FITKModelEnum::AbsModelType getAbsModelType();

        /**
         * @brief 获取part下的网格
         * @return 网格数据
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-03-15
         */
        Interface::FITKAbaMeshPartVTK* getMesh();
        /**
         * @brief 获取集合/表面管理器
         * @return Interface::FITKModelSetManager*
         * @author libaojun (libaojunqd@foxmail.com)
         * @date 2024-03-17
         */
        Interface::FITKComponentManager* getComponentManager() override;

        /**
        * @brief 根据绝对成员获取集合，不存在则创建新的集合
        * @param[i] t             集合类型
        * @param[i] member        成员
        * @return FITKModelSet*
        * @author LiBaojun (libaojunqd@foxmail.com)
        * @date 2024-05-29
        */
        Interface::FITKModelSet* getModelSetByMember(Interface::FITKModelEnum::FITKModelSetType t, const QList<int>  &member);


        /**
         * @brief 获取截面（section）指派管理器
         * @return 截面（section）指派管理器
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-03-22
         */
        Interface::FITKSectionAssignManager* getSectionAssignManager();
        /**
         * @brief 获取工程特征
         * @return FITKAbaPartEngineeringFeature
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-05-27
         */
        Interface::FITKAbaPartEngineeringFeature* getPartEngineerFeature();

        /**
         * @brief 获取坐标管理器
         * @return FITKCoordinateSystemManager
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-06-06
         */
        Interface::FITKCoordinateSystemManager* getCoordinateSystemManager();
        /**
         * @brief 获取材料方向管理器
         * @return FITKAbaMaterialOrientationManager
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-06-06
         */
        Interface::FITKAbaMaterialOrientationManager* getMaterialOrientationManager();
        /**
         * @brief 获取Beam方向管理器
         * @return Interface::FITKAbaBeamOrientationManager*
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-04
         */
        Interface::FITKAbaBeamOrientationManager* getBeamOrientationManager();

        /**
         * @brief 获取面网格划分参数 如果dim==2
         * @return 面网格划分参数
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-12-23
         */
        Interface::FITKSurfaceMeshingParameter* getSurfaceMeshParameter();

        /**
         * @brief 获取体网格划分参数 如果dim==3
         * @return 体网格划分参数
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-12-23
         */
        Interface::FITKVolumeMeshingParameter* getVolumeMeshParameter();

        /**
         * @brief 获取模型维度
         * @return FITKModelDim
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-04-11
         */
        virtual Interface::FITKModelEnum::FITKModelDim getModelDim() override;

        /**
         * @brief 获取点坐标
         * @param[i]  pointID  点ID
         * @param[o]  coor 节点坐标
         * @param[i]  modelIndex 模型索引，用于复合模型（一个模型包含多个子模型）
         * @return  bool 是否获取成功
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-04-19
         */
        virtual bool getPointCoor(int pointID, double* coor, int modelIndex = 0) override;
        /**
        * @brief 通过命令设置形状代理器ID
        * @param[i]  ID  几何命令ID
        * @author LiBaojun (libaojunqd@foxmail.com)
        * @date 2024-11-20
        */
        void setGeoCommand(const int cid);
        /**
        * @brief 获取几何命令
        * return  Interface::FITKAbsGeoShapeAgent*
        * @author LiBaojun (libaojunqd@foxmail.com)
        * @date 2024-11-20
        */
        Interface::FITKAbsGeoCommand* getGeoCommandObj();

    private:
        /***
       * @brief 设置数据对象ID，需谨慎使用
       * @param ID 数据对象id
       * @author LiBaojun (libaojunqd@foxmail.com)
       * @date 2024-06-18
       */
        void setAbsDataID(const int id) override;

    private:
        /**
         * @brief 几何模型命令ID
         * @author libaojun (libaojunqd@foxmail.com)
         * @date 2024-03-17
         */
        int _geoCommandID{ -1 };
        /**
         * @brief 网格数据
         * @author fulipeng (flipengqd@yeah.net)
         * @date 2024-03-15
         */
        Interface::FITKAbaMeshPartVTK* _mesh{};
        /**
         * @brief 集合/表面管理器
         * @author libaojun (libaojunqd@foxmail.com)
         * @date 2024-03-17
         */
        Interface::FITKComponentManager* _setSurfManager{};

        /**
         * @brief 截面（section）指派管理器
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-03-22
         */
        Interface::FITKSectionAssignManager* _sectionAssignManager{};
        /**
         * @brief 工程特征，包含转动惯量等
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-05-27
         */
        Interface::FITKAbaPartEngineeringFeature* _engineeringFeature{};
        /**
         * @brief 局部坐标系
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-06-06
         */
        Interface::FITKCoordinateSystemManager* _csysManager{};

        /**
         * @brief 材料方向管理
         * @author libaojun (libaojunqd@foxmail.conm)
         * @date 2024-06-06
         */
        Interface::FITKAbaMaterialOrientationManager* _materialOrientationManager{};

        /**
         * @brief beam方向管理
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-04
         */
        Interface::FITKAbaBeamOrientationManager* _beamOrientationManager{};

        /**
         * @brief 面网格划分参数
         * @author fulipeng (flipengqd@yeah.net)
         * @date 2024-12-24
         */
        Interface::FITKSurfaceMeshingParameter* _surfaceMeshingParameter{};

        /**
         * @brief 体网格划分参数
         * @author fulipeng (flipengqd@yeah.net)
         * @date 2024-12-24
         */
        Interface::FITKVolumeMeshingParameter* _volumeMeshingParameter{};
    };



    /**
     * @brief Abaqus Part 的数据管理器
     * @author fulipeng (flipengqd@yeah.net)
     * @date 2024-03-15
     */
    class FITKAbaqusDataAPI FITKAbaqusPartManager : public Core::FITKAbstractObject,
        public Core::FITKAbstractDataManager<FITKAbaqusPart>
    {
    public:
        explicit FITKAbaqusPartManager() = default;
        virtual ~FITKAbaqusPartManager() = default;
        /**
        * @brief 移除对象
        * @param[i]  obj            需要移除的对象
        * @author LiBaojun (libaojunqd@foxmail.com)
        * @date 2024-05-03
        */
        void removeDataObj(Core::FITKAbstractDataObject* obj) override;
    };
}



#endif
